A typical process for removing phosphorus using a membrane filtration is described in U.S. Pat. No. 6,485,645. The system described uses a membrane to filter mixed liquor received from the aerobic zone. The material to rejected by the membrane filter is removed from the process by returning the material (activated sludge) to the aerobic and anoxic zones. In a membrane bioreactor process the membranes are typically kept clean by flowing air bubbles past the membrane surfaces. This results in the returned activated sludge (RAS) to anoxic tank normally containing high amounts of dissolved oxygen (DO) due to extra air which is supplied for cleaning the membranes. The return activated sludge rich in dissolved oxygen not only consumes more carbon source, but also significantly impacts on phosphorus removal.